

$(function () {
    var htmlAdBtn = '';
    $("#jdAdSlide img").each(function(index, image) {
        var id = "adImage" + index;
        htmlAdBtn = htmlAdBtn + '<a href="javascript:" class="jd_ad_btn_a" data-rel="' + id + '">' + '</a>';
        image.id = id;
    });
   $("#jdAdBtn").html(htmlAdBtn).find("a").powerSwitch({
        eventType: "hover",
        classAdd: "active",
       animation: "fade",
       autoTime: 5000,
        onSwitch: function(image) {
           if (!image.attr("src")) {
               image.attr("src", image.attr("data-src"));	
           }
        }
   }).eq(0).trigger("mouseover");



    $('.float_2').on('mouseenter', function(event) {
        event.preventDefault();
        $('.ewm_wrap').fadeIn();
    });

    $('.float_2,.ewm_wrap').on('mouseleave',
    function(event) {
        event.preventDefault();
        floattimer=setTimeout(function(){
            $('.ewm_wrap').fadeOut();
        },300);
    });

    $('.ewm_wrap').on('mouseenter', function(event) {
        event.preventDefault();
        clearInterval(floattimer);
    });
})
